package com.cloud.netty.handler;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

/**
 * @program: netty
 * @description:
 * @author: Cloud
 * @create: 2022/4/13 11:10:25
 */
public class MyServerInitializer extends ChannelInitializer<SocketChannel> {


    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();

        // 需要一个入站的handler进行解码MyByteTolong
        pipeline.addLast(new MyByteTolong());

        // 加入自定义的编码器
        pipeline.addLast(new MyServerLongToByte());

        pipeline.addLast(new MyServerHandler());


    }
}
